import { Navigate } from "react-router-dom";
import Home from "./pages/Home";
import Login from "./pages/Login";
import Layout from "./pages/Layout";
import Kuqu from "./pages/Cangku/Kuqu";
import Kuwei from "./pages/Cangku/Kuwei";
import Cangku from "./pages/Cangku/Cangku";
import Rukugl from "./pages/ChuRu/Rukugl";
import Ckgl from "./pages/ChuRu/Ckgl";
import Rkjilu from "./pages/ChuRu/Rkjilu";
import Ckjilu from "./pages/ChuRu/Ckjilu";
import Kcyiwei from "./pages/ChuRu/Kcyiwei";
import Query from "./pages/Kucun/Query";
import Product from "./pages/Jichu/Product";
import Customer from "./pages/Jichu/Customer";
import Field from "./pages/Jichu/Field";
import User from "./pages/System/User";
import Department from "./pages/System/Department";
import Permission from "./pages/System/Permission";
// 导入其他需要的组件

const routers = [
  {
    path: "/",
    element: <Navigate to="/Login" replace />, // 根路径重定向到登录页
  },
  {
    path: "/Login",
    element: <Login />,
  },
  {
    path: "/Layout",
    element: <Layout />,
    children: [
      {
        path: "/Layout",
        element: <Navigate to="/Layout/Home" replace />, // Layout根路径重定向到仪表盘
      },
      {
        path: "/Layout/Home",
        element: <Home />,
      },
      {
        path: "/Layout/Cangku",
        children: [
          {
            path: "/Layout/Cangku/Cangku",
            element: <Cangku />,
          },
          {
            path: "/Layout/Cangku/Kuqu",
            element: <Kuqu />,
          },
          {
            path: "/Layout/Cangku/Kuwei",
            element: <Kuwei />,
          },
        ],
      },
      {
        path: "/Layout/ChuRu",
        children: [
          {
            path: "/Layout/ChuRu/Rukugl",
            element: <Rukugl />,
          },
          {
            path: "/Layout/ChuRu/Ckgl",
            element: <Ckgl />,
          },
          {
            path: "/Layout/ChuRu/Rkjilu",
            element: <Rkjilu />,
          },
          {
            path: "/Layout/ChuRu/Ckjilu",
            element: <Ckjilu />,
          },
          {
            path: "/Layout/ChuRu/Kcyiwei",
            element: <Kcyiwei />,
          },
        ],
      },
      {
        path: "/Layout/Kucun",
        children: [
          {
            path: "/Layout/Kucun/Query",
            element: <Query />,
          },
        ],
      },
      {
        path: "/Layout/Jichu",
        children: [
          {
            path: "/Layout/Jichu/Product",
            element: <Product />,
          },
          {
            path: "/Layout/Jichu/Customer",
            element: <Customer />,
          },
          {
            path: "/Layout/Jichu/Field",
            element: <Field />,
          },
        ],
      },
      {
        path: "/Layout/System",
        children: [
          {
            path: "/Layout/System/User",
            element: <User />,
          },
          {
            path: "/Layout/System/Department",
            element: <Department />,
          },
          {
            path: "/Layout/System/Permission",
            element: <Permission />,
          },
        ],
      },
    ],
  },
];

export default routers;
